#pragma once
#include "file_server.h"
#include <string>

struct ContinuousShootingFileServerOption :FileServerOption
{
	bool enable_thumbnail;
	std::string thumbnail_directory;
	std::string thumbnail_url;

	std::shared_ptr<FileServerOption> Create() const override {
		return make_shared<ContinuousShootingFileServerOption>(*this);
	}
};

struct ContinuousShootingInfo
{
	string cs_name;
	string cs_full_path;
	std::time_t last_write_time;
	int image_num;
};

class ContinuousShootingFileServer :public FileServer {
public:

	ContinuousShootingFileServer(ContinuousShootingFileServerOption& option);

	void QueryServerFiles(evhttp_request* req) override;

	void QueryServerDirs(evhttp_request* req) override;

	void RenameServerFile(evhttp_request* req) override;

	void DeleteServerFile(evhttp_request* req) override;
protected:
	static int SearchContinuousShootingFiles(fs::path dir_path, unsigned int start, unsigned int limit, vector<ContinuousShootingInfo>& cs_infos);

	static int SearchContinuousShootingDirs(fs::path dir_path, unsigned int start, unsigned int limit, vector<DirInfo>& dir_infos);
};